﻿using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using SuppKids.Core.Extensions;

namespace SuppKids.Converters
{
	public class EnumToLocalizedValueConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if ((bool)(DesignerProperties.IsInDesignModeProperty.GetMetadata(typeof(DependencyObject)).DefaultValue))
			{
				return string.Empty;
			}

			return value.GetLocalizedEnumValue();
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return default(Enum);
		}
	}
}